#include <bits/stdc++.h>
using namespace std;

int n, l, a[200001], b[200001];
int f[4050], ans;

void dfs(int i, int aop, int bop) {
	if (aop > l) return;
	if (i == n + 1) {
		ans = max(ans, bop);
		return;
	}
	dfs(i + 1, aop ^ a[i], bop ^ b[i]);
	dfs(i + 1, aop, bop);
}

int main() {
	freopen("lock.in", "r", stdin);
	freopen("lock.out", "w", stdout);
	scanf("%d%d", &n, &l);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", &a[i], &b[i]);
	}
	if (n <= 18) {
		dfs(1, 0, 0);
		printf("%d\n", ans);
	} else {
		for (int i = 1; i <= n; ++i) {
			for (int j = l; j >= 0; --j) {
				ans = max(ans, f[j] = max(f[j ^ a[i]] ^ b[i], f[j]));
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}
